<?php

require_once 'src/config/cfPetshop.php';

class dbConnection extends cfPetshop {

    private $user = "root";
    private $pass = "1234";
    private $host = "localhost";
    private $database = "dbpetshop";

    private function Connect() {
        $conn = new PDO("mysql:host=$this->host;dbname=$this->database", $this->user, $this->pass);
        return $conn;
    }

    /*
     * INSERT, UPDATE, DELETE retorna um true ou false
     */
    public function RunQuery($sql) {
        $stm = $this->Connect()->prepare($sql);
        return $stm->execute();
    }
    /*
     * SELECTS retorna uma lista
     */
    public function RunSelect($sql) {
        $stm = $this->Connect()->prepare($sql);
        $stm->execute();
        return $stm->fetchAll(PDO::FETCH_ASSOC);
    }

}
?>	
